#ifndef CLOCK_H
#define CLOCK_H

#include <lvgl.h>
#include <WiFi.h>
#include <SD.h>
#include <HTTPClient.h>
#include <ESP32Time.h>
#include "../../common.h"


extern const lv_img_dsc_t clock_icon;
extern const lv_img_dsc_t clock_0;
extern const lv_img_dsc_t clock_1;
extern const lv_img_dsc_t clock_2;
extern const lv_img_dsc_t clock_3;
extern const lv_img_dsc_t clock_4;
extern const lv_img_dsc_t clock_5;
extern const lv_img_dsc_t clock_6;
extern const lv_img_dsc_t clock_7;
extern const lv_img_dsc_t clock_8;
extern const lv_img_dsc_t clock_9;
// extern const lv_img_dsc_t clock_icon;
#define RGB565_BUFFER_SIZE 28850
class Clock
{
  private:
  uint8_t *display_buf;
  File file_pilot;
  uint32_t l = 0;
  lv_obj_t *scr, *label_time, *label_date;
  lv_obj_t *img_time_hr0, *img_time_hr1;
  lv_obj_t *img_time_mn0, *img_time_mn1;
  lv_style_t font_style_time, font_style_date;
  ESP32Time timer;
  String time, date;
  int is_update = -1;
  long timecal;
  Event event;
  void show_time();
  bool update_time();
  void play_ani();
  lv_img_dsc_t clock_icon_list[10] = {clock_0, clock_1, clock_2, clock_3, clock_4, clock_5, clock_6, clock_7, clock_8, clock_9};


  
  public:
  Clock();
  ~Clock();
  Event main_process(Action);

};

#endif
